﻿<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
 <link rel="stylesheet" type="text/css" href="{{asset('bootstrap-3.3.7/css/bootstrap.min.css')}}">
<link rel="stylesheet" type="text/css" href="{{asset('admin/static/h-ui/css/H-ui.min.css')}}" />
<link rel="stylesheet" type="text/css" href="{{asset('admin/static/h-ui.admin/css/H-ui.admin.css')}}" />
<link rel="stylesheet" type="text/css" href="{{asset('admin/lib/Hui-iconfont/1.0.8/iconfont.css')}}" />
<link rel="stylesheet" type="text/css" href="{{asset('admin/static/h-ui.admin/skin/default/skin.css')}}" id="skin" />
<link rel="stylesheet" type="text/css" href="{{asset('admin/static/h-ui.admin/css/style.css')}}" />
<!--[if IE 6]>
<script type="text/javascript" src="Admin/Admin/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>产品分类</title>
</head>
<body>
 <div id="Common">
  @include('Common/tip')
  </div>
<script>
  //一次性定时器 让错误提示2秒后消失
 setTimeout(function () {
      

      var common = document.getElementById('Common');

      common.style.display = 'none';

    }, 3000);
</script>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 分类管理 <span class="c-gray en">&gt;</span> 分类列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
	<div class="page-container">
		<div class="text-c"> 
			<form class="" action="{{url('Admin/product-category',"sname")}}" method="get">
				<input type="text" name="sname" id="" placeholder=" 分类名称" style="width:250px" class="input-text">
				<button name="" id="" class="btn btn-success" type="submit"><i class="Hui-iconfont">&#xe665;</i> 搜分类</button>
			</form>
		</div>
		<div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l">  <a class="btn btn-primary radius"  onclick="category_add('添加分类','{{url('Admin/product-category/create')}}')" href="javascript:;"><i class="Hui-iconfont">&#xe600;</i> 添加分类</a></span>  </div>
		<div class="mt-20">
			<table class="table table-border table-bordered table-bg table-hover table-sort">
				<thead>
					<tr class="text-c">
						<!-- <th width="40"><input name="" type="checkbox" value=""></th> -->
						<th width="40">ID</th>
						<th width="80">父类Pid</th>
						<th width="180">分类名称</th>
						<th width="100">描述</th>
						<th width="100">路径Path</th>
						<th width="60">状态</th>
						<th width="120">操作</th>
					</tr>
				</thead>
				<tbody>
					@foreach($categorys as $v)
						
					<tr class="text-c va-m">
						<!-- <td><input name="" type="checkbox" value=""></td> -->
						<td>{{$v->id}}</td>
						<td>{{$v->pid}}</td>
						<td style="text-align:left;">{{$v->nbsp}}|--{{$v->sname}}</td>
						<td>{{$v->descr}}</td>
						<td>{{$v->path}}</td>
						<td >{{$v->state}}</td>
						<td class="td-manage"><a href="{{url('Admin/product-category/childAdd', $v->id)}}"class="btn">添加</a>
						 <a href="{{url('Admin/product-category/'.$v->id.'/edit')}}" class="btn">编辑</a> 
		 				<!-- <form class="" action="{{url('/product-category', $v->id)}}" method="post">
					                  {{csrf_field()}}
					                  {{ method_field('DELETE') }}
					             <button type="submit" class="btn">删除</button>
						</form> --><a href="javascript:;" onclick="delCate({{$v->id}})"class="btn">删除</a> </td>
					</tr>
					@endforeach
					
				</tbody>
				
			</table>
		</div>
	
	</div>

<script type="text/javascript" src="{{asset('admin/lib/jquery/1.9.1/jquery.min.js')}}"></script>
<script type="text/javascript" src="{{asset('admin/lib/layer/2.4/layer.js')}}"></script>
<script type="text/javascript" src="{{asset('admin/static/h-ui/js/H-ui.min.js')}}"></script>
<script type="text/javascript" src="{{asset('admin/static/h-ui.admin/js/H-ui.admin.js')}}"></script> <!--/_footer 作为公共模版分离出去-->
<!-- <script src="{{asset('js/jquery.js')}}"></script>
<script src="{{asset('bootstrap-3.3.7/js/bootstrap.min.js')}}"></script> -->
<!--请在下方写此页面业务相关的脚本-->

<!-- <script type="text/javascript" src="{{asset('admin/lib/zTree/v3/js/jquery.ztree.all-3.5.min.js')}}"></script> -->
<script type="text/javascript" src="{{asset('admin/lib/My97DatePicker/4.8/WdatePicker.js')}}"></script>
<script type="text/javascript" src="{{asset('admin/lib/datatables/1.10.0/jquery.dataTables.min.js')}}"></script>
<script type="text/javascript" src="{{asset('admin/lib/laypage/1.2/laypage.js')}}"></script>
<!-- <script type="text/javascript" src="{{asset('/js/jquery.js')}}"></script> -->
<script type="text/javascript" src="{{asset('bootstrap-3.3.7/js/bootstrap.min.js')}}"></script>
<!-- <script type="text/javascript" src="{{asset('admin/other/js/layer.js')}}"></script> -->

<script type="text/javascript">

function category_add(title,url){
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}

	function delCate (id) {

		layer.confirm('确定要删除此分类？如果有子分类，子分类会变为根分类', {
			  btn: ['确定','取消']  
			}, function(){
				$.post( "{{url('Admin/product-category/')}}/"+id,
					{'_method':'delete', '_token':"{{csrf_token()}}"}, 
					function (data) {
						if(data.status == 0){
							location.href = location.href;
							layer.alert(data.msg, {icon: 6});
						}else{
							layer.alert(data.msg, {icon: 5});
						}

				});
			}, function(){
 
			});
	}

 

	// $('a.btn-add').on('click', function ()
	// 	{
	// 		var id = {{$v->id}};
	// 		alert(id);
	// 		$.ajax({
	// 			type: 'post',
	// 			url: '{{("")}}',
	// 			data:,
	// 			success:function (msg) {
	// 				console.log(msg);//php返回的数据
	// 			},
	// 		});
	// 	});
	// $('a.btn-edit').on('click', function ()
	// 	{
	// 		alert(2);
	// 	});
	// $('a.btn-del').on('click', function ()
	// 	{
	// 		alert(3);
	// 	});
// var setting = {
// 	view: {
// 		dblClickExpand: false,
// 		showLine: false,
// 		selectedMulti: false
// 	},
// 	data: {
// 		simpleData: {
// 			enable:true,
// 			idKey: "id",
// 			pIdKey: "pId",
// 			rootPId: ""
// 		}
// 	},
// 	callback: {
// 		beforeClick: function(treeId, treeNode) {
// 			var zTree = $.fn.zTree.getZTreeObj("tree");
// 			if (treeNode.isParent) {
// 				zTree.expandNode(treeNode);
// 				return false;
// 			} else {
// 				demoIframe.attr("src",treeNode.file + ".blade.php");
// 				return true;
// 			}
// 		}
// 	}
// };

// var zNodes =[
// 	{ id:1, pId:0, name:"一级分类", open:true},
// 	{ id:11, pId:1, name:"二级分类"},
// 	{ id:111, pId:11, name:"三级分类"},
// 	{ id:112, pId:11, name:"三级分类"},
// 	{ id:113, pId:11, name:"三级分类"},
// 	{ id:114, pId:11, name:"三级分类"},
// 	{ id:115, pId:11, name:"三级分类"},
// 	{ id:12, pId:1, name:"二级分类 1-2"},
// 	{ id:121, pId:12, name:"三级分类 1-2-1"},
// 	{ id:122, pId:12, name:"三级分类 1-2-2"},
// ];
		
// var code;
		
// function showCode(str) {
// 	if (!code) code = $("#code");
// 	code.empty();
// 	code.append("<li>"+str+"</li>");
// }
		
// $(document).ready(function(){
// 	var t = $("#treeDemo");
// 	t = $.fn.zTree.init(t, setting, zNodes);
// 	demoIframe = $("#testIframe");
// 	//demoIframe.on("load", loadReady);
// 	var zTree = $.fn.zTree.getZTreeObj("tree");
// 	//zTree.selectNode(zTree.getNodeByParam("id",'11'));
// });
</script>
</body>
</html>